var AjaxPro = function() {
    return {
        call: function(option) {
            $.ajax({
                type: "POST",
                url: option.url,
                data: $.toJSON(option.params),
                beforeSend: function(xhr) {
                    xhr.setRequestHeader("X-AjaxPro-Method", option.method);
                },
                success: function(s) {
                    var o = null;
                    eval("o = " + s + ";");
                    if (o.error) {
                        option.failed(o.error);
                    } else {                    
                        option.success(o.value);
                    }
                },
                error: function() {
                    option.failed({Message: 'An unexpected error has been occurred. Please contact your administrators to help solving this problem.'});
                }
            });
        }
    }
}();